home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 29 / CDT29.iso / e-Mail / WorldClient Pro 2.2.3 / wcsetup.exe / WEBHELP.ZIP / sitemap / MyBufferedInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-10-21  |  791 b   |  43 lines

  1. package sitemap;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. public class MyBufferedInputStream {
  7.    InputStream m_is;
  8.    byte[] m_buffer = new byte[16384];
  9.    int m_nBufferCount = 0;
  10.    int m_nBytesRead = 0;
  11.  
  12.    private void RefreshBuffer() {
  13.       try {
  14.          this.m_nBytesRead = this.m_is.read(this.m_buffer);
  15.          this.m_nBufferCount = this.m_nBytesRead;
  16.       } catch (IOException var1) {
  17.          this.m_nBytesRead = 0;
  18.          this.m_nBufferCount = -1;
  19.       }
  20.    }
  21.  
  22.    public void close() throws IOException {
  23.       this.m_is.close();
  24.    }
  25.  
  26.    public MyBufferedInputStream(InputStream var1) {
  27.       this.m_is = var1;
  28.    }
  29.  
  30.    public int read() throws IOException {
  31.       if (this.m_nBufferCount == 0) {
  32.          this.RefreshBuffer();
  33.       }
  34.  
  35.       if (this.m_nBufferCount < 0) {
  36.          return -1;
  37.       } else {
  38.          this.m_nBufferCount += -1;
  39.          return this.m_buffer[this.m_nBytesRead - (this.m_nBufferCount + 1)] < 0 ? this.m_buffer[this.m_nBytesRead - (this.m_nBufferCount + 1)] + 256 : this.m_buffer[this.m_nBytesRead - (this.m_nBufferCount + 1)];
  40.       }
  41.    }
  42. }
  43.